package com.itheima.reggie.controller;

import com.itheima.reggie.common.R;
import com.itheima.reggie.entity.Orders;
import com.itheima.reggie.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: wf
 * @Desc:  订单
 * @Date: 2022-08-24 21:26:53
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class OrdersController {

    @Autowired
    private OrdersService ordersService;

    /**
     * 功能描述: 提交订单
     * @param orders
     * @return com.itheima.reggie.common.R<java.lang.String>
     */
    @PostMapping("/submit")
    private R<String> submit(@RequestBody Orders orders){
        log.info("去支付{}",orders.toString());

        ordersService.submitOrder(orders);

        return R.success("提交订单成功");
    }
}
